﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="DutySCRegisterEnquiry.aspx.cs" Inherits="MTRC.ODMS.Web.SOM.DutySCRegister.DutySCRegisterEnquiry" %>

<%@ Register Assembly="APJ.Web.UI.WebControls" Namespace="APJ.Web.UI.WebControls"
    TagPrefix="APJ" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="AjaxControlToolkit" %>
<%@ Register Src="~/UserControl/Menu/PageFoot.ascx" TagName="PageFoot" TagPrefix="WebStructure" %>
<%@ Register Src="~/UserControl/Menu/TabStrip.ascx" TagName="TabStrip" TagPrefix="WebStructure" %>
<%@ Register Src="~/UserControl/Menu/PageHead.ascx" TagName="PageHead" TagPrefix="WebStructure" %>
<%@ Register Src="~/UserControl/Menu/MainMenu.ascx" TagName="MainMenu" TagPrefix="WebStructure" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Operational Data Management System</title>
    <link href="<%=ResolveUrl("~/CSS/common.css")%>" rel="stylesheet" type="text/css" />
    <link href="../../CSS/common.css" rel="stylesheet" type="text/css" />
    
      <script src="../../Javascript/SOM/Common.js" type="text/javascript"></script>
    <script src="../../Javascript/CommonFunction.js" type="text/javascript"></script>

    <script language="javascript">
    
    function OpenEntryPageMaximum(url)  //huangyao 20081129 in MTR office
    {
        //debugger;
        var aaa = url;
        //xopen(url, window.screen.width, window.screen.height,'yes',null);
        //xopen(url, 1024, 768,'yes',null);
        //alert("test by huangyao");
    //  window.moveTo(0,0);   
    //  window.resizeTo(screen.availWidth,screen.availHeight);   
    //  window.outerWidth=screen.availWidth;   
    //  window.outerHeight=screen.availHeight;   

//          newwin=window.open("","","scrollbars=yes, toolbar=yes, menubar=yes, location=yes, status=yes, resizable=yes");
//          if   (document.all)
//          {   
//            newwin.moveTo(0,0);   
//            newwin.resizeTo(screen.width,screen.height - 25);
//          }   
        //          newwin.location=url;

        //added by Nathan 2015-08-20
        var dateFrom;
        var dateTo;
        var station = document.getElementById("ddlStation").value;
        var inputAll = document.getElementsByTagName("input");
        for (var i = 0; i < inputAll.length; i++) {
            if (inputAll[i].type == "text" && inputAll[i].id.indexOf("dtbFrom") >= 0) {
                dateFrom = inputAll[i].value;
            }
            if (inputAll[i].type == "text" && inputAll[i].id.indexOf("dtbTo") >= 0) {
                dateTo = inputAll[i].value;
            }
        }
        var FreeTextcblShow = document.getElementById("chkFlag").checked;
        SetCookie("AdmissionRegistryEnquiry_ddlStation", station);
        SetCookie("AdmissionRegistryEnquiry_dateFrom", dateFrom);
        SetCookie("AdmissionRegistryEnquiry_dateTo", dateTo);
        SetCookie("AdmissionRegistryEnquiry_chkFlag", FreeTextcblShow);
        window.location.href = (url + "&isBack=1&PageID=DutySCRegisterEnquiry");

        //added by Nathan 2015-08-20
    }
    //added by Nathan 2015-08-20
      function setSearchCookie() {
          var isBack = getQueryString("isBack");
          if (isBack == "1") {
              var station = GetCookie("AdmissionRegistryEnquiry_ddlStation");
              if (station != "" && station != null) {
                  document.getElementById("ddlStation").value = GetCookie("AdmissionRegistryEnquiry_ddlStation");
                  document.getElementById("dtbFrom_dateTextBox").value = GetCookie("AdmissionRegistryEnquiry_dateFrom");
                  document.getElementById("dtbTo_dateTextBox").value = GetCookie("AdmissionRegistryEnquiry_dateTo");
                  if (GetCookie("AdmissionRegistryEnquiry_chkFlag").toUpperCase() == "TRUE") {
                      document.getElementById("chkFlag").checked = true;
                  } else {
                      document.getElementById("chkFlag").checked = false;
                  }
                  SetCookie("AdmissionRegistryEnquiry_ddlStation", "");
                  SetCookie("AdmissionRegistryEnquiry_dateFrom", "");
                  SetCookie("AdmissionRegistryEnquiry_dateTo", "");
                  SetCookie("AdmissionRegistryEnquiry_chkFlag", "");
                  document.getElementById("btnSearch").click();              
              } 
          } 
      }
      //added by Nathan 2015-08-20

    </script>

    <link href="~/CSS/Menu.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <form id="form1" runat="server">  
        <AjaxControlToolkit:ToolkitScriptManager ID="ToolkitScriptManager" runat="server">
        </AjaxControlToolkit:ToolkitScriptManager>      
            <table border="0" cellpadding="0" cellspacing="0" class="Page_Container">
                <tr>
                   <td colspan="2" class="Page_Head">
                        <WebStructure:PageHead ID="PageHead" runat="server" />
                    </td>
                </tr>               
                <tr>
                    <td class="Page_Left">
                        <WebStructure:MainMenu ID="MainMenu" runat="server" AppPath="../../" CurrMenuID="M1407" />
                    </td>
                    <td class="Page_Right">
                       <table class="Page_Contents">
                          <tr>
                            <td class="TabStrip"><WebStructure:TabStrip ID="TabStrip" CurrMenuID="M140701" ParentMenuID="M1407" DMenuMode="CurrOnly" runat="server" /></td>
                          </tr>
                          <tr>
                            <td class="Contents" style="height: 16px">
                             
                             <!--**********context Begin *****************-->
                             <fieldset style="clear:both; margin-bottom:5px;background-color: #eeeeee;">
                                        <table cellpadding="0" cellspacing="0" width="100%">
                                            <tr>
                                                <td>
                                                    &nbsp;<asp:Label ID="lblStaion" runat="server" Text="Station"></asp:Label>
                                                </td>
                                                <td>
                                                    <asp:DropDownList ID="ddlStation" runat="server" CssClass="ddlStation"></asp:DropDownList>
                                                </td>                                            
                                                <td>
                                                    <asp:Label ID="lblFrom" runat="server" Text="From"></asp:Label>
                                                </td>
                                                <td>
                                                    <APJ:DateTextBox ID="dtbFrom" runat="server" />
                                                </td>
                                                <td>
                                                    <asp:Label ID="lblTo" runat="server" Text="To"></asp:Label>
                                                </td>
                                                <td>
                                                    <APJ:DateTextBox ID="dtbTo" runat="server" />
                                                </td>
                                                <td align="right">
                                                    <asp:Label ID="lblDisplay" runat="server" Text="Display"></asp:Label>
                                                </td>
                                                <td>
                                                    <asp:CheckBox ID="chkFlag" runat="server" Text="Display Obsolote" />
                                                </td>
                                                <td>
                                                    &nbsp;<asp:Button ID="btnSearch" runat="server" Text="Search" OnClick="btnSearch_Click" />
                                                </td>
                                                <td>
                                                    <asp:Button ID="btnNew" runat="server" Text="New Record" OnClick="btnNew_Click" />
                                                </td>
                                                <td>
                                                    <asp:Button ID="btnExport" runat="server" Text="Export To Excel" OnClick="btnExport_Click" />
                                                </td>
                                            </tr>
                                        </table>
                            </fieldset>
                            
                                    <APJ:CommonGridView ID="grvData" runat="server" DataKeyNames="StationEventID" AllowPaging="True" AllowSorting="True" AscPic="~/Images/Common/arrow_up_green.png" AutoGenerateColumns="False" BorderColor="black" CssClass="GridView" DescPic="~/Images/Common/arrow_down_green.png" EnableTheming="True" OnRowDataBound="grvData_RowDataBound" OnNeedDataBind="grvData_NeedDataBind">
                                        <Columns>
                                            <asp:BoundField DataField="EventNo" HeaderText="SOM_RegNo" SortExpression="EventNo" >
                                                <itemstyle width="15%" />
                                            </asp:BoundField>
                                            <asp:BoundField DataField="EventTime" HeaderText="SOM_RegDateTime" SortExpression="EventTime" >
                                                <itemstyle width="16%" />
                                            </asp:BoundField>
                                            <asp:BoundField DataField="Shift" HeaderText="SOM_Shift" SortExpression="Shift" >
                                                <itemstyle width="10%" />
                                            </asp:BoundField>
                                            <asp:BoundField DataField="StaffID" HeaderText="SOM_StaffID" SortExpression="StaffID" >
                                                <itemstyle width="7%" />
                                            </asp:BoundField>
                                            <asp:BoundField DataField="StaffName" HeaderText="SOM_StaffName" SortExpression="StaffName" >
                                                <itemstyle width="20%" />
                                            </asp:BoundField>
                                            <asp:BoundField DataField="JobTitle" HeaderText="Com_Title" SortExpression="JobTitle" >
                                                <itemstyle width="25%" />
                                            </asp:BoundField>
                                            <asp:TemplateField HeaderText="COM_Status" SortExpression="EventStatus">
                                                <edititemtemplate>
<asp:TextBox id="TextBox1" runat="server" Text='<%# Bind("EventStatusID") %>' __designer:wfdid="w4"></asp:TextBox>
</edititemtemplate>
                                                <itemstyle width="7%" />
                                                <itemtemplate>
<div style="display:none;"><asp:Label id="lblStatusID" runat="server" Text='<%# Bind("EventStatusID") %>' __designer:wfdid="w3"></asp:Label></div> <asp:Image id="imgStatus" runat="server" __designer:wfdid="w5"></asp:Image>
</itemtemplate>
                                            </asp:TemplateField>
                                        </Columns>
                                        <PagerTemplate>
                                            <asp:Table ID="CommonPagerTemplate" runat="server" Width="100%">
                                                <asp:TableRow ID="COMGRIDV_TR" runat="server">
                                                    <asp:TableCell ID="COMGRIDV_Pager_Cell_TotalRecords" runat="server" CssClass="GridView_Pager_Cell_TotalRecords">
                                                        <asp:Label ID="Lbl_T_TotalRecords" runat="server">Total Records:</asp:Label>
                                                        <asp:Label ID="Lbl_V_TotalRecords" runat="server"></asp:Label>
                                                        &nbsp; &nbsp;
                                                        <asp:Label ID="Lbl_V_CurPage" runat="server"></asp:Label>
                                                        &nbsp;<asp:Label runat="server">/</asp:Label>
                                                        &nbsp;<asp:Label ID="Lbl_V_TotalPages" runat="server"></asp:Label>
                                                    </asp:TableCell>
                                                    <asp:TableCell ID="COMGRIDV_Pager_Cell_PageSize" runat="server" CssClass="GridView_Pager_Cell_PageSize">
                                                        <asp:Label ID="Lbl_T_PageSize" runat="server">PageSize:</asp:Label>
                                                        &nbsp;&nbsp;<asp:DropDownList ID="DDL_PageSize" runat="server" AutoPostBack="True">
                                                            <asp:ListItem Value="5">5</asp:ListItem>
                                                            <asp:ListItem Value="10">10</asp:ListItem>
                                                            <asp:ListItem Value="15">15</asp:ListItem>
                                                            <asp:ListItem Value="20">20</asp:ListItem>
                                                            <asp:ListItem Value="25">25</asp:ListItem>
                                                            <asp:ListItem Value="30">30</asp:ListItem>
                                                        </asp:DropDownList>
                                                    </asp:TableCell>
                                                    <asp:TableCell ID="COMGRIDV_Pager_Cell_Prev" runat="server" CssClass="GridView_Pager_Cell_Prev">
                                                        <asp:LinkButton ID="LBtn_Previous" runat="server" CommandArgument="Prev" CommandName="Page"><</asp:LinkButton>
                                                    </asp:TableCell>
                                                    <asp:TableCell ID="COMGRIDV_Pager_Cell_PagerLink" runat="server" CssClass="GridView_Pager_Cell_PagerLink">
                                                        <asp:Panel ID="Pnl_PageLink" runat="server" CssClass="GridView_Pager_PageLinkPanel">
                                                        </asp:Panel>
                                                    </asp:TableCell>
                                                    <asp:TableCell ID="COMGRIDV_Pager_Cell_Next" runat="server" CssClass="GridView_Pager_Cell_Next">
                                                        <asp:LinkButton ID="LBtn_Next" runat="server" CommandArgument="Next" CommandName="Page">></asp:LinkButton>
                                                    </asp:TableCell>
                                                </asp:TableRow>
                                            </asp:Table>
                                        </PagerTemplate>
                                        <RowStyle CssClass="GridView_Row" />
                                        <HeaderStyle CssClass="GridView_Header" />
                                        <AlternatingRowStyle CssClass="GridView_AlternativeRow" />
                                        <EmptyDataRowStyle CssClass="GridView_Header" />
                                        <EmptyDataTemplate>
                                            <asp:Table runat="server" CssClass="GridView_Header_EmptyData">
                                                <asp:TableRow runat="server">
                                                    <asp:TableCell runat="server" Style="border-right: black 1px solid;" Width="15%"></asp:TableCell>
                                                    <asp:TableCell runat="server" Style="border-right: black 1px solid;" Width="16%"></asp:TableCell>
                                                    <asp:TableCell runat="server" Style="border-right: black 1px solid;" Width="10%"></asp:TableCell>
                                                    <asp:TableCell runat="server" Style="border-right: black 1px solid;" Width="7%"></asp:TableCell>
                                                    <asp:TableCell runat="server" Style="border-right: black 1px solid;" Width="20%"></asp:TableCell>
                                                    <asp:TableCell runat="server" Style="border-right: black 1px solid;" Width="25%"></asp:TableCell>
                                                    <asp:TableCell runat="server" Width="7%"></asp:TableCell>
                                                </asp:TableRow>
                                            </asp:Table>
                                        </EmptyDataTemplate>
                                    </APJ:CommonGridView>
                                 
                             <!--**********context End *****************-->
                            </td>
                          </tr>
                          <tr>
                            <td class="Page_Foot" style="height: 54px"><WebStructure:PageFoot ID="PageFoot" runat="server" /></td>
                          </tr>
                       </table>                                              
                    </td>
                </tr>                
            </table>        
    </form>
</body>
<script>
setSearchCookie() ;
</script>
</html>
